%读取数据
inspiration_stuff=readtable('./data.xlsx','Sheet','stuff','ReadVariableNames',true,'TextType','string');
inspiration_limits=readtable('./data.xlsx','Sheet','limits','ReadVariableNames',true,'TextType','string');
% [~,ia,ic] = unique(inspiration_stuff.name);

%构建问题
Nstuff=height(inspiration_stuff);
inspiration_stuff.score=inspiration_stuff.culture+inspiration_stuff.scenery+inspiration_stuff.color;
A=[inspiration_stuff.culture inspiration_stuff.scenery inspiration_stuff.color].';
b=[inspiration_limits.culture;inspiration_limits.scenery;inspiration_limits.color];
lb=zeros(Nstuff,1);
ub=ones(Nstuff,1);
choose = intlinprog(-1.0*inspiration_stuff.score,1:Nstuff,A,b,[],[],lb,ub);

%输出结果
index=logical(choose);
choose_stuff=inspiration_stuff.name(index).';
choose_stuff=join(choose_stuff,'、');
fprintf("请选择:%s\n",choose_stuff);
fprintf("灵感总和为:%d\n",inspiration_stuff.score.'*choose);
cost=int32(A*choose);
fprintf("人文灵感:%d/%d 风景灵感:%d/%d 色彩灵感:%d/%d \n",cost(1),inspiration_limits.culture,cost(2),inspiration_limits.scenery,cost(3),inspiration_limits.color);
